﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AzureDiagMon.Common.Algorithms.FragmentedRanges;
using AzureDiagMon.Common.Dtos;

namespace AzureDiagMon.Common.Interfaces.Services
{
    public interface IDataStoreService
    {
        event EventHandler<EventArgs> LogEntriesChanged;
        event EventHandler<EventArgs> WadLogDownloadedSectionsChanged;

        void AddSubscription(SubscriptionDto subscription);

        IEnumerable<StorageAccountDto> ListStorageAccounts();
        void AddStorageAccount(StorageAccountDto storageAccountDto);

        int GetLogEntryCount(StorageAccountDto storageAccount, EventFilter filter);
        IList<WadLogEntryDto> ListLogEntries(StorageAccountDto storageAccount, EventFilter filter);
        IList<WadLogEntryDto> ListLogEntries(StorageAccountDto storageAccount, EventFilter filter, int startIndex, int count);
        void AddLogEntries(StorageAccountDto storageAccount, IEnumerable<WadLogEntryTableEntity> entries);
        IQueryable<WadLogEntryDto> GetLogEntries(StorageAccountDto storageAccount, EventFilter filter);


        void AddWadLogDownloadedSection(WadLogDownloadedSectionDto downloadedSectionDto);
        IEnumerable<WadLogDownloadedSectionDto> ListWadLogDownloadedSections(int storageAccountId, DateTime? from = null, DateTime? to = null);
        IEnumerable<WadLogDownloadedSectionDto> ListWadLogDownloadedSections(StorageAccountDto storageAccountDto, DateTime? from = null, DateTime? to = null);
        void ConsolidateWadLogDownloadedSections(StorageAccountDto storageAccountDto);

        WadLogDownloadedSectionsInfo GetWadLogDownloadedSectionsInfo(StorageAccountDto storageAccountDto, 
                                                                     DateTime start, DateTime end);
    }

}
